﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace GeneralAdaptiveFramework
{
    public abstract class Interface
    {
        public Component component;
        public Object condition { get; set; }
        public Connection connection;
        public String name { get; set; }

        public Interface()
        {
            condition = (bool)false;
            connection = null;
        }
        public Interface(string _name, Component _component)
        {
            condition = (bool)false;
            connection = null;
            name = _name;
            component = _component;
        }

        /**
         * Return true if port is connected and otherwise - false
         */
        public Object getPortCondition()
        {
            return condition;
        }

        public void registerConnection(Connection _connection)
        {
            connection = _connection;
            condition = (bool)true;
        }

        /**
         * Remove the connect tion between it and its required port.
         */
        public void removeConnection()
        {
            //connection = null;
            condition = false;
        }

        public Connection getConnection()
        {
            return connection;
        }
    }
}
